package com.xinnet.mms.roleresources.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xinnet.core.dao.impl.BaseDaoImpl;
import com.xinnet.mms.entity.Resources;
import com.xinnet.mms.entity.Role;
import com.xinnet.mms.entity.RoleResources;
import com.xinnet.mms.roleresources.dao.RoleResourcesDao;
@Repository("roleResourcesDao")
public class RoleResourcesDaoImpl extends BaseDaoImpl<RoleResources,Long> implements RoleResourcesDao{

	@Override
	public List<Resources> getResourcesListByRoleId(String roleId) {
		// TODO Auto-generated method stub
		List<Resources> resourceslList = super.getSqlSession().selectList("RoleResources.getResourcesListByRoleId",roleId);
		if(resourceslList!=null && resourceslList.size()==0){
			return null;
		}
		return resourceslList;
	}

	@Override
	public void delRoleResourcesByRoleId(String roleId) {
		// TODO Auto-generated method stub
		super.getSqlSession().delete("RoleResources.delRoleResourcesByRoleId",roleId);
	}

	@Override
	public void addRoleResources(RoleResources roleResources){
		// TODO Auto-generated method stub
		super.getSqlSession().insert("RoleResources.addRoleResources",roleResources);
	}

}
